package com.linsir.model;

import com.jfinal.plugin.activerecord.Db;
import com.linsir.common.base.BaseModel;
import com.linsir.common.utils.xx;

import java.util.List;

/**
 * @author linsir
 * @title: Task
 * @projectName linsir-mu
 * @description: TODO
 * @date 2021/12/2 23:50
 */
public class Task extends BaseModel<Task> {

    private static final long serialVersionUID = 4254060861819273244L;

    public static final Task dao = new Task();

    /** 暂停 **/
    public static final int STATE_STOP = 0;
    /** 运行 **/
    public static final int STATE_START = 1;

    public List<Task> findAll(){
        return this.find("select * from eova_task");
    }

    public List<Task> findByStart(){
        return this.find("select * from eova_task where state = 2");
    }

    public int updateState(int id, int state){
        return Db.use(xx.DS_EOVA).update("update eova_task set state = ? where id = ?", state, id);
    }
}
